function S=computeSConstraint(Hu, cB, constraintsE, constraintsF, constraintsG, multiColumnPowersAB)
gamma = constraintsG(1:end, 1:end-1);

eTerm = [];
fTerm = [];
gTerm = [];

if (~isempty(constraintsE))
    eTerm = constraintsE(1:end, 1:end-1);
end

if (~isempty(constraintsF))
    fTerm = generateConstraintsFancyF(Hu, cB, Hu, constraintsF);
end

if (~isempty(constraintsG))
    gTerm = gamma * multiColumnPowersAB;
end

S = [eTerm; fTerm; gTerm];
end